﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Proto;
using Summer;

namespace GameServer.Model
{
    //在MMO世界进行同步的实体
    public class Entity
    {
        private int speed;              //移动速度
        private Vector3Int position;    //位置
        private Vector3Int direction;   //方向
        private NEntity netObj;         //网络对象
        
        public int entityId { get { return netObj.Id; } }
        public Vector3Int Position
        {
            get { return position; }
            set { 
                position = value; 
                netObj.Position = value;
            }
        }
        public Vector3Int Direction
        {
            get { return direction; }
            set { 
                direction = value; 
                netObj.Direction = value;
            }
        }
        public int Speed 
        {
            get { return speed; }
            set
            {
                speed = value;
                netObj.Speed = value;
            }
        }


        public Entity(Vector3Int pos,Vector3Int dir)
        {
            netObj = new NEntity();
            Position = pos;
            Direction = dir;
        }

        public Proto.NEntity EntityData
        {
            get { return netObj; }
            set
            {
                netObj = value;
                position = netObj.Position;
                direction = netObj.Direction;
            }
        }


    }
}
